<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<script src="./vue.js"></script>

<body>
    <div id="app">
        <label>
            <input type="checkbox" v-model="flagAll" @change="change"> 全选
        </label>
        <br>
        <label v-for="(item,index) in list" :key="index">
            <input type="checkbox" v-model="child[index]" @change="schange">{{item}}
        </label>
    </div>
    <script>
        new Vue({
            el: '#app',
            data: {
                flagAll: false,
                list: ["吃饭", "洗衣服", "睡觉"],
                child: []
            },
            methods: {
                change() {
                    if (this.flagAll) {
                        this.child = []
                        this.child.push(this.flagAll, this.flagAll, this.flagAll)
                    }
                    if (this.flagAll === false) {
                        this.child = []
                        this.child.push(this.flagAll, this.flagAll, this.flagAll)
                    }

                },
                schange() {
                  if(this.child.includes(false)){
                    this.flagAll=false
                    }  
                    if(this.child[0]&&this.child[1]&&this.child[2])
                        this.flagAll=true
                  
                }
            }
        })
    </script>
</body>

</html>